package app.nexd.com.indoor.mode;

import android.os.Parcel;
import android.os.Parcelable;

import com.baidu.mapapi.model.LatLng;

/**
 * 城市属性实体类
 *
 * @author gugalor
 */
public class CityModel implements Parcelable {
    private String cityName; //城市名字
    private String nameSort; //城市首字母
    private String cityCode; // 城市编号
    private String cityEname; // 城市英文名
    private double centerLat; // 中心点的纬度
    private double centerLng; // 中心点的经度


    protected CityModel(Parcel in) {
        cityName = in.readString();
        nameSort = in.readString();
        cityCode = in.readString();
        cityEname = in.readString();
        centerLat = in.readDouble();
        centerLng = in.readDouble();
    }

    public static final Creator<CityModel> CREATOR = new Creator<CityModel>() {
        @Override
        public CityModel createFromParcel(Parcel in) {
            return new CityModel(in);
        }

        @Override
        public CityModel[] newArray(int size) {
            return new CityModel[size];
        }
    };

    public LatLng getCenterLatLng() {
        return new LatLng(centerLat, centerLng);
    }

    public CityModel() {

    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    public String getNameSort() {
        return nameSort;
    }

    public void setNameSort(String nameSort) {
        this.nameSort = nameSort;
    }

    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }

    public String getCityCode() {
        return this.cityCode;
    }

    public String getCityEname() {
        return cityEname;
    }

    public void setCityEname(String cityEname) {
        this.cityEname = cityEname;
        String nameSort = this.cityEname.toUpperCase().substring(0, 1);
        setNameSort(nameSort);
    }

    public double getCenterLat() {
        return centerLat;
    }

    public void setCenterLat(double centerLat) {
        this.centerLat = centerLat;
    }

    public double getCenterLng() {
        return centerLng;
    }

    public void setCenterLng(double centerLng) {
        this.centerLng = centerLng;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(cityName);
        dest.writeString(nameSort);
        dest.writeString(cityCode);
        dest.writeString(cityEname);
        dest.writeDouble(centerLat);
        dest.writeDouble(centerLng);
    }
}
